﻿
using System;

namespace SindelsStarship
{
    class SpaceShip
    {
        int playField;

        public int PlayField
        {
            get { return playField; }
            set { playField = value; }
        }
        int posX;

        public int PosX
        {
            get { return posX; }
            set { posX = value; }
        }
        int posY;

        public int PosY
        {
            get { return posY; }
            set { posY = value; }
        }
        string frontShip = "|";

        public string FrontShip
        {
            get { return frontShip; }
            set { frontShip = value; }
        }
        string backShip = "o0o";

        public string BackShip
        {
            get { return backShip; }
            set { backShip = value; }
        }
        ConsoleColor color;

        public ConsoleColor Color
        {
            get { return color; }
            set { color = value; }
        }


        public SpaceShip(int playField)
        {         
            this.playField = playField;
            this.color = ConsoleColor.Red;
        }

        public void MoveLeft()
        {
            this.PosX--;
            if (this.PosX < 0)
            {
                this.PosX = 0;
            }
        }

        public void MoveRight()
        {
            this.PosX++;
            if (this.PosX >= this.PlayField - 3)
            {
                this.PosX = this.PlayField - 3;
            }
        }

        public void MoveUp()
        {
            this.PosY--;
            if (this.PosY <1)
            {
                this.PosY = 1;
            }
        }

        public void MoveDown()
        {
            this.PosY++;
            if (this.PosY >Console.WindowHeight- 1)
            {
                this.PosY = Console.WindowHeight- 1;
            }
        }


        public void GoToStartPosition()
        {
            this.PosX = (this.PlayField - 1) / 2;
            this.PosY = Console.WindowHeight - 1;
        }


        //TODO implement MoveLeft(), MoveRight(), MoveUp(), MoveDown() methods
    }
}
